<?php
/*
|--------------------------------------------------------------------------
| JWT Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

//登录+退出+获取验证码+刷新
Route::post('login','Api\LoginController@login')->name('login');
Route::post('getQrInfo','Api\LoginController@getQrInfo')->name('getQrInfo');
Route::post('register','SystemManagement\UserController@store');//测试使用
Route::get('getCode','Api\LoginController@getCode');
Route::get('getQrCode','Api\LoginController@qrcode');
Route::get('qrLogin','Api\LoginController@qrLogin');

Route::group(['middleware'=>['refresh','log']],function (){
    Route::group(['namespace'=>"Api"],function (){
        //登录账户信息查看
        Route::get('userInfo','LoginController@userInfo');
        Route::post('quit','LoginController@logout');
        Route::get('refresh','LoginController@refresh');
    });

    //垃圾桶信息管理
    Route::namespace('HardWareApi')->group(function() {
        Route::prefix('hardWardApi')->group(function() {
            Route::get('subscribe','TrashMessageController@queryTrash');
            Route::get('publish','TrashMessageController@queryTrashInfo');
            Route::resource('trash','TrashMessageController',['only'=>['index', 'show', 'store', 'update', 'destroy']]);
        });
    });

    Route::namespace('OperationManagement')->group(function() {
        //环卫区域
        Route::prefix('sanitation')->group(function() {
            Route::resource('areas','ProjectAreasController',['only'=>['index', 'show', 'store', 'update', 'destroy']]);
            Route::get('areas/getMap','ProjectAreasController@getAll');
            //批量删除
            Route::delete('areas/destroy/{ids}','ProjectAreasController@delete');
        });

        //区域广场水域管理
        Route::prefix('sanitation')->group(function() {
            Route::resource('otherAreas','OtherAreasController',['only'=>['index', 'show', 'store', 'update', 'destroy']]);
            //批量删除
            Route::delete('otherAreas/destroy/{ids}','OtherAreasController@delete');
        });

        //工作模拟
        Route::prefix('statistics')->group(function () {
            Route::get('operationTotal','SanitationStatisticsController@operationTotal');
            Route::get('vegetationTotal','SanitationStatisticsController@vegetationTotal');
        });

        //道路基础数据导入
        Route::prefix('sanitation')->group(function() {
            Route::resource('data','SanitationDataController',['only'=>['index', 'show', 'store', 'update', 'destroy']]);
            //批量删除
            Route::delete('data/destroy/{ids}','SanitationDataController@delete');
        });
        //接水点导入
        Route::prefix('water')->group(function() {
            Route::resource('point','WaterPointController',['only'=>['index', 'show', 'store', 'update', 'destroy']]);
            //批量删除
            Route::delete('point/destroy/{ids}','WaterPointController@delete');
        });
        //生活垃圾处理厂导入
        Route::prefix('treatment')->group(function() {
            Route::resource('domestic','DomesticTreatmentPlantsController',['only'=>['index', 'show', 'store', 'update', 'destroy']]);
            //批量删除
            Route::delete('domestic/destroy/{ids}','DomesticTreatmentPlantsController@delete');
        });
        //厨余垃圾处理厂导入
        Route::prefix('treatment')->group(function() {
            Route::resource('kitchen','KitchenTreatmentPlantsController',['only'=>['index', 'show', 'store', 'update', 'destroy']]);
            //批量删除
            Route::delete('kitchen/destroy/{ids}','KitchenTreatmentPlantsController@delete');
        });
        //处理厂导入
        Route::prefix('treatment')->group(function() {
            Route::resource('plant','TreatmentPlantController',['only'=>['index', 'show', 'store', 'update', 'destroy']]);
            //批量删除
            Route::delete('plant/destroy/{ids}','TreatmentPlantController@delete');
        });
        //二次分拣中心导入
        Route::prefix('transfer')->group(function() {
            Route::resource('plant','TransferPlantController',['only'=>['index', 'show', 'store', 'update', 'destroy']]);
            //批量删除
            Route::delete('plant/destroy/{ids}','TransferPlantController@delete');
        });
        //焚烧厂导入
        Route::prefix('incineration')->group(function() {
            Route::resource('plant','IncinerationPlantController',['only'=>['index', 'show', 'store', 'update', 'destroy']]);
            //批量删除
            Route::delete('plant/destroy/{ids}','IncinerationPlantController@delete');
        });
        //公厕数据导入
        Route::prefix('sanitation')->group(function() {
            Route::resource('toilet','SanitationToiletController',['only'=>['index', 'show', 'store', 'update', 'destroy']]);
            //公厕数据导入批量删除
            Route::delete('toilet/destroy/{ids}','SanitationToiletController@delete');
        });
        //环卫部件导入
        Route::prefix('sanitation')->group(function() {
            //道路信息查看顶级列表
            Route::get('scope/parentList','JobScopeController@getParentList');
            //道路信息查看分段路段列表
            Route::get('scope/sonList','JobScopeController@getSonList');
            //作业范围确认统计管理
            Route::resource('scope','JobScopeController',['only'=>['index', 'show', 'store', 'update', 'destroy']]);
            //作业范围确认统计表批量删除
            Route::delete('scope/destroy/{ids}','JobScopeController@delete');
        });
        //市政部件管理
        Route::prefix('government')->group(function() {
            //市政部件类型管理
            Route::resource('deviceCategory','GovernmentDeviceCategoryController',['only'=>['index', 'show', 'store', 'update', 'destroy']]);
            //市政部件类型导入表批量删除
            Route::delete('deviceCategory/destroy/{ids}','GovernmentDeviceCategoryController@delete');
            //市政部件导入管理
            Route::resource('device','GovernmentDeviceController',['only'=>['index', 'show', 'store', 'update', 'destroy']]);
            //市政部件导入表批量删除
            Route::delete('device/destroy/{ids}','GovernmentDeviceController@delete');
        });
        //垃圾点位统计
        Route::prefix('trash')->group(function() {
            Route::resource('site','TrashSiteController',['only'=>['index', 'show', 'store', 'update', 'destroy']]);
            //垃圾点位统计表批量删除
            Route::delete('site/destroy/{ids}','TrashSiteController@delete');
        });
        //站点管理
        Route::prefix('sanitation')->group(function() {
            Route::resource('site','SanitationSiteController',['only'=>['index', 'show', 'store', 'update', 'destroy']]);
            //站点批量删除
            Route::delete('site/destroy/{ids}','SanitationSiteController@delete');
        });
        //站点类型管理
        Route::prefix('sanitation')->group(function() {
            Route::get('category/getAll','SanitationCategoryController@getAll');
            Route::resource('category','SanitationCategoryController',['only'=>['index', 'show', 'store', 'update', 'destroy']]);
        });
        //环卫管理
        Route::prefix('sanitation')->group(function() {
            //任务管理
            Route::resource('task','SanitationTaskController',['only'=>['index', 'show', 'store', 'update', 'destroy']]);
            //任务批量删除
            Route::delete('task/destroy/{ids}','SanitationTaskController@delete');
        });

    });


    Route::namespace('Landscaping')->group(function() {
        //园林基础数据导入
        Route::prefix('landscaping')->group(function() {
            //列表-分页
            Route::get('index', 'LandscapingController@index');
            //列表-不分页
            Route::get('list', 'LandscapingController@getAll');
            //新增
            Route::post('create','LandscapingController@create');
            //编辑
            Route::get('edit/{id}','LandscapingController@show');
            //修改保存
            Route::put('update/{id}','LandscapingController@update');
            //删除
            Route::delete('delete/{id}','LandscapingController@delete');
            //条件搜索
            Route::get('find','LandscapingController@select');
        });

        //绿化基础数据导入
        Route::resource('virescence','ParkVegetationController',['only'=>['index', 'show', 'store', 'update', 'destroy']]);
        //绿化基础数据导入批量删除
        Route::delete('virescence/destroy/{ids}','ParkVegetationController@delete');

        //园林植被种类
        Route::prefix('vegetation')->group(function() {
            //列表-分页
            Route::get('index', 'VegetationController@index');
            //列表-不分页
            Route::get('list', 'VegetationController@getAll');
            //新增
            Route::post('create','VegetationController@create');
            //编辑
            Route::get('edit/{id}','VegetationController@show');
            //修改保存
            Route::put('update/{id}','VegetationController@update');
            //删除
            Route::delete('delete/{id}','VegetationController@delete');
            //批量删除
            Route::delete('destroy/{ids}','VegetationController@destroy');
        });

        //绿化基础设施
        Route::group([],function () {
            Route::resource('greenDevice', 'GreenDeviceController', ['only' => ['index', 'show', 'store', 'update', 'destroy']]);
            //绿化基础设施批量删除
            Route::delete('greenDevice/destroy/{ids}', 'GreenDeviceController@delete');
        });

        //任务类型管理
        Route::group([],function () {
            Route::get('taskCategory/getAll','TaskCategoryController@getAll');
            Route::resource('taskCategory', 'TaskCategoryController', ['only' => ['index', 'show', 'store', 'update', 'destroy']]);
            Route::delete('taskCategory/destroy/{ids}', 'TaskCategoryController@delete');
        });

        //园林绿化管理
        Route::prefix('park')->group(function() {

            //养护信息操作
            Route::group([],function () {
                Route::resource('manintenance', 'ParkManintenanceController', ['only' => ['index', 'show', 'store', 'update', 'destroy']]);
                //批量删除
                Route::delete('manintenance/destroy/{ids}', 'ParkManintenanceController@delete');
            });
            //工种工作量预设表操作
            Route::group([],function () {
                Route::resource('job', 'ParkJobController', ['only' => ['index', 'show', 'store', 'update', 'destroy']]);
                //项目添加
                Route::post('job/addProject', 'ParkJobController@createProject');
                //工种工作量添加
                Route::post('job/addJob', 'ParkJobController@createJob');
                //工种工作量预设表批量删除
                Route::delete('job/destroy/{ids}', 'ParkJobController@delete');
            });
            //养护内容预设表操作
            Route::group([],function () {
                Route::resource('protect', 'ParkProtectController', ['only' => ['index', 'show', 'store', 'update', 'destroy']]);
                //批量删除
                Route::delete('protect/destroy/{ids}', 'ParkProtectController@delete');
            });
            //养护记录方案表操作
            Route::group([],function () {
                Route::resource('record', 'ParkRecordController', ['only' => ['index', 'show', 'store', 'update', 'destroy']]);
                //批量删除
                Route::get('record/destroy/{ids}', 'ParkRecordController@delete');
                //根据上传人id查询员工姓名
                Route::get('getNameById/{id}', 'ParkRecordController@getNameById');
            });
            //病毒规程库表操作
            Route::group([],function () {
                Route::resource('virus', 'ParkVirusController', ['only' => ['index', 'show', 'store', 'update', 'destroy']]);
                //批量删除
                Route::delete('virus/destroy/{ids}', 'ParkVirusController@delete');
            });
            //虫害规程库表操作
            Route::group([],function () {
                Route::resource('pest', 'ParkPestController', ['only' => ['index', 'show', 'store', 'update', 'destroy']]);
                //批量删除
                Route::delete('pest/destroy/{ids}', 'ParkPestController@delete');
            });
            //养护信息管理表操作
            Route::group([],function () {
                Route::resource('message', 'ParkMessageController', ['only' => ['index', 'show', 'store', 'update', 'destroy']]);
                //批量删除
                Route::delete('message/destroy/{ids}', 'ParkMessageController@delete');
            });
            //任务管理
            Route::group([],function () {
                Route::resource('task', 'ParkTaskController', ['only' => ['index', 'show', 'store', 'update', 'destroy']]);
                //批量删除
                Route::delete('task/destroy/{ids}', 'ParkTaskController@delete');
            });
        });

    });

    //excel数据导出
    Route::group(['prefix' => 'excel','namespace'=>'OperationManagement'],function (){
        Route::post('sanitation/import','SanitationSiteController@import');//站点导入
        Route::post('governmentDevice/import','GovernmentDeviceController@import');//市政部件导入
        Route::get('trash/export','TrashSiteController@export');//垃圾点位导出
        Route::post('trash/import','TrashSiteController@import');//垃圾点位导入
        Route::post('sanitationToilet/import','SanitationToiletController@import');//公厕数据导入
    });

    //系统管理
    Route::group(['namespace'=>'SystemManagement','prefix'=>'system'],function(){
        //用户管理
        Route::group([],function (){
            Route::get('getUserRole/{id}','UserController@getUserHasRole');
            Route::put('user/updateCondition/{id}','UserController@updateCondition');
            Route::put('user/updatePwd/{user}','UserController@updatePwd');
            Route::delete('user/del','UserController@del');
            Route::resource('user','UserController',['only'=>['index', 'show', 'store', 'update','destroy']]);
        });
        //用户信息--作废
        Route::group([],function (){
            Route::get('manager','ManagerController@getManager');
            Route::get('getManager','ManagerController@getAll');
            Route::get('manager/{id}','ManagerController@getOneManager');
            Route::post('manager','ManagerController@createManager');
            Route::put('manager/{id}','ManagerController@updateManager');
            Route::delete('manager/del','ManagerController@del');
            Route::post('manager/recover','ManagerController@rec');
            Route::post('manager/condition','ManagerController@getBy');
        });
        //用户分配角色
        Route::group([],function (){
            Route::post('userRole','UserRoleController@roleToUser');
        });
        //角色 √
        Route::group([],function (){
            Route::get('role','RoleController@getRole');
            Route::get('getRole','RoleController@getAll');
            Route::get('role/getRoleRulesTree/{id}','RoleController@getRoleRulesTree');
            Route::get('role/getRoleMenusTree/{id}','RoleController@getRoleMenusTree');
            Route::get('role/{id}','RoleController@getOneRole');
            Route::post('role','RoleController@createRole');
            Route::put('role/{id}','RoleController@updateRole');
            Route::delete('role/del','RoleController@del');
            Route::post('role/recover','RoleController@rec');
            Route::post('role/condition','RoleController@getBy');
        });
        //角色类型
        Route::group([],function (){
            Route::get('roleCategory','RoleCategoryController@getRoleCategory');
            Route::get('getRoleCategory','RoleCategoryController@getAll');
            Route::get('roleCategory/{id}','RoleCategoryController@getOneRoleCategory');
            Route::post('roleCategory','RoleCategoryController@createRoleCategory');
            Route::put('roleCategory/{id}','RoleCategoryController@updateRoleCategory');
            Route::delete('roleCategory/del','RoleCategoryController@del');
            Route::post('roleCategory/recover','RoleCategoryController@rec');
            Route::post('roleCategory/condition','RoleCategoryController@getBy');
        });
        //角色分配权限 √
        Route::group([],function (){
            Route::get('roleRelation/{id}','RolePrivilegeController@getRolePri');
            Route::post('roleRelation','RolePrivilegeController@addRolePri');
            Route::put('roleRelation/{id}','RolePrivilegeController@updateRolePri');
        });
        //权限 √
        Route::group([],function (){
            Route::get('privilege','PrivilegeController@getPrivilege');
            Route::get('getPrivilege','PrivilegeController@getAll');
            Route::get('privilege/allRoutes','PrivilegeController@allRoutes');
            Route::get('privilege/{id}','PrivilegeController@getOnePrivilege');
            Route::post('privilege','PrivilegeController@createPrivilege');
            Route::put('privilege/{id}','PrivilegeController@updatePrivilege');
            Route::delete('privilege/del','PrivilegeController@del');
            Route::post('privilege/recover','PrivilegeController@rec');
            Route::post('privilege/condition','PrivilegeController@getBy');
        });
        //员工 √
        Route::group([],function (){
            Route::get('employee','EmployeeController@index');
            Route::get('employee/getDataByCond','EmployeeController@getDataByCond');
            Route::get('getEmployee','EmployeeController@getAll');
            Route::get('employee/{id}','EmployeeController@showEmp');
            Route::post('employee','EmployeeController@store');
            Route::put('employee/{id}','EmployeeController@upEmp');
            Route::get('getPrivilegeById/{id}','EmployeeController@getPrivilegeById');
            Route::delete('employee/del','EmployeeController@del');
            Route::post('employee/import','EmployeeController@import');
        });
        //部门 √
        Route::group([],function (){
            Route::get('department','DepartmentController@getDepart');
            Route::get('getDepart','DepartmentController@getAll');
            Route::get('department/{id}','DepartmentController@getOneDepart');
            Route::post('department','DepartmentController@createDepart');
            Route::put('department/{id}','DepartmentController@updateDepart');
            Route::delete('department/del','DepartmentController@del');
            Route::post('department/recover','DepartmentController@rec');
            Route::get('getDepartByCond','DepartmentController@getBy');
            Route::post('department/setPrincipal','DepartmentController@setPrincipal');
            Route::post('department/setEmployeePrincipal','DepartmentController@setEmployeePrincipal');
        });
        //岗位 √
        Route::group([],function (){
            Route::get('post','PostController@getPost');
            Route::get('post/getAll','PostController@getAll');
            Route::get('post/{id}','PostController@getOnePost');
            Route::post('post','PostController@createPost');
            Route::put('post/{id}','PostController@updatePost');
            Route::delete('post/del','PostController@del');
            Route::post('post/recover','PostController@rec');
            Route::get('getPostCond','PostController@getBy');
        });
        //职级
        Route::group([],function (){
            //职级工作内容批量删除
            Route::delete('skill/destroy/{ids}','SkillController@delete');
            //批量恢复职级
            Route::post('skill/recover','SkillController@rec');
            //修改员工对应职级
            Route::put('skill/updateInfo','SkillController@updateInfo');
            Route::resource('skill','SkillController',['only'=>['index', 'show', 'store', 'update', 'destroy']]);
        });
        //职级工作内容
        Route::group([],function (){
            //职级工作内容批量删除
            Route::delete('skillJob/destroy/{ids}','SkillJobController@delete');
            //批量恢复职级工作内容
            Route::post('skillJob/recover','SkillJobController@rec');
            Route::resource('skillJob','SkillJobController',['only'=>['index', 'show', 'store', 'update', 'destroy']]);
        });
        //组织
        Route::group([],function (){
            Route::get('organization','OrganizationController@getOrganization');
            Route::get('organization/{id}','OrganizationController@getOneOrganization');
            Route::post('organization','OrganizationController@createOrganization');
            Route::put('organization/{id}','OrganizationController@updateOrganization');
            Route::delete('organization/del','OrganizationController@del');
            Route::post('organization/recover','OrganizationController@rec');
            Route::get('getOrganCond','OrganizationController@getBy');
            Route::get('getCategory','OrganizationController@getCate');
            Route::post('organization/setPrincipal','OrganizationController@setPrincipal');
        });
        //注册公司账户管理
        Route::group([],function () {
            Route::resource('customer', 'CustomerController', ['only' => ['index', 'show', 'store', 'update', 'destroy']]);
            //批量删除
            Route::delete('customer/destroy/{ids}', 'CustomerController@delete');
        });
        //操作日志 √
        Route::group([],function (){
            Route::get('log','LogController@getLog');
            Route::get('log/seek','LogController@seekLog');
            Route::delete('log/del','LogController@delLog');
            Route::delete('log/del/time','LogController@delLogByTime');
        });
        //班次 √
        Route::group([],function (){
            Route::post('banci','BanciController@store');
            Route::get('banci','BanciController@index');
            Route::get('banci/{id}','BanciController@show');
            Route::put('banci/{id}','BanciController@update');
            Route::delete('banci/{id}','BanciController@destroy');
        });
        //员工任务分派
        Route::group([],function (){
            // Route::post('userTask','UserTaskController@userTask');
        });
        //工作区域
        Route::group([],function (){
            Route::resource('workspace','WorkspaceController');
        });
    });

    //人员管理信息
    Route::group(['prefix' => 'personInfo','namespace'=>'PersonInfoManagement'],function (){
        Route::get('infos/export','PersonInfoController@export');//导出
        Route::post('infos/import','PersonInfoController@import');//导入
        Route::resource('infos','PersonInfoController',['only'=>['index', 'show', 'store', 'update']]);
        //临时用工信息
        Route::group([],function () {
            Route::resource('temporary', 'TemporaryController', ['only' => ['index', 'show', 'store', 'update', 'destroy']]);
            //批量删除
            Route::delete('temporary/destroy/{ids}', 'TemporaryController@delete');
        });
    });

    //表格表头自定义
    Route::group(['prefix' => 'system','namespace'=>'SystemManagement'],function (){
        Route::resource('customTable','CustomTableController',['only'=>['index', 'show', 'store', 'update', 'destroy']]);
        //表格表头自定义信息批量删除
        Route::delete('customTable/destroy/{ids}','CustomTableController@delete');
    });

});


